<?php
namespace app\controller\admin;

use app\BaseController;
use app\controller\AdminController;
use think\facade\Request;

use app\model\SettingModel;

class Setting extends AdminController{

    public function index(){

        $settings = SettingModel::get_all();
        return $settings;
        $list = [];
        foreach( $settings as $key=>&$item){
            $list[ $item['code'] ][ $item['key'] ] = $item;
        }
        
        return $list ;

    }


    public function edit(){

        $res = [
            'status'=>0
        ];

        $data = $_POST['settings'];

        $res['num_rows'] = SettingModel::set_all( $data );

        echo json_encode( $res );

    }
}